package com.leyou.user.web;

import com.leyou.user.dto.AddressDTO;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author YYP
 * @date 2021/1/15
 */
@RestController
@RequestMapping("/address")
public class AddressController {


    /**
     * 根据用户id以及地址id查询用户地址
     * @param userId
     * @param id
     * @return
     */
    @GetMapping
    public ResponseEntity<AddressDTO> queryUserAddress(@RequestParam("userId") Long userId, @RequestParam("id") Long id) {
        AddressDTO addressDTO = new AddressDTO();
        addressDTO.setId(id);
        addressDTO.setUserId(userId);
        addressDTO.setStreet("航头镇航头路18号传智播客 3号楼");
        addressDTO.setCity("上海");
        addressDTO.setDistrict("浦东新区");
        addressDTO.setAddressee("社会我拓哥");
        addressDTO.setPhone("15800000000");
        addressDTO.setProvince("上海");
        addressDTO.setPostcode("210000");
        addressDTO.setIsDefault(true);

        return ResponseEntity.ok(addressDTO);
    }
}
